<%-- 
    Document   : borderlayout
    Created on : 2019-1-25, 9:55:13
    Author     : dusin
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>教学助手</title>
        <script type="text/javascript" src="../../js/jquery/jquery.min.js"></script>
        <script type="text/javascript" src="../../js/jquery/jquery.easyui.min.js"></script>
        <link rel="stylesheet" href="../../js/jquery/themes/default/easyui.css" type="text/css" />
        <link rel="stylesheet" href="../../js/jquery/themes/icon.css" type="text/css" />
        <script language="JavaScript">
            var courseName = '';
            var teachclassid = ''
            $(document).ready(function() {
                $('#ccSemester').combobox('select', 1);
                
            });
            function onSelectCourse(rec) {
                $.ajax({url: "../../servlet/teacher/SelectTeacherClass",
                    data: {id: rec.id, coursename: rec.text},
                    //type : "POST",
                    //请求的媒体类型
                    //contentType: "text/json;charset=UTF-8",
                    dataType:"text",   //没有设置dataType时，会跳入 error，请求时成功的（返回的数据类型是字符串）
                    success: function(result) {
                        var r = eval('(' + result + ')');
                        if (r.success) {
                            courseName = rec.text;
                            teachclassid = rec.id;
                            //window.frames["mainFrame"].$('#dg').datagrid('reload');
                            //window.frames["mainFrame"].$('#dg').datagrid('getPanel').panel('setTitle', rec.text);
                            /*var src = $('#mainFrame').attr('src');
                            alert(src);
                            $('#mainFrame').attr('src',src);//不能写成 var url='${url}';$('#mainFrame').attr('src',url); 前后台程序执行时机不同
                           */
                            document.getElementById("mainFrame").contentWindow.location.reload();
                            //$.messager.show({ title:'提示', msg:'您选择了课程'+rec.text, timeout:5000, showType:'slide'});
                        } else {
                            $.messager.show({title: '提示', msg: '您选择了课程' + rec.text + '失败', timeout: 5000, showType: 'slide'});
                        }
                    },
                    error: function(result) {
                        $.messager.show({title: '提示', msg: '课程选择失败，请稍后再试' + rec.text, timeout: 5000, showType: 'slide'});
                    }
                });
            }
        </script>
        <style>
            .footer {
                width: 100%;
                text-align: center;
                line-height: 35px;
            }
            .top-bg {
                background-color: #d8e4fe;
                height: 80px;

            }
        </style>
    </head>
    <body class="easyui-layout">
        <div region="north" border="true" split="true" style="overflow: hidden; height: 80px;">
            <div class="top-bg"><img src="../../img/icon/logo_72.png"/>
                <div style="float:right;font:normal 16px tahoma, arial, sans-serif, 宋体;margin:30px 30px 0 10px;z-index:1000">                       
                    <img src="../../img/icon/user.png" width="16" height="16" />&nbsp;<span>${teacherNo}&nbsp;老师</span>&nbsp;|&nbsp; 
                    <img src="../../img/icon/sign_out.png" width="16" height="16" /><a href="logout.jsp?type=1" style="color:blue"> 注销</a>
                </div>            
            </div>

        </div>
        <div region="south" border="true" split="true" style="overflow: hidden; height: 40px;">
            <div class="footer">版权所有：<a href="http://www.dusin.com">JUST工作室</a></div>
        </div>
        <div region="west" split="true"  style="width: 200px;">
            <div class="easyui-layout" data-options="fit:true">
                <div region="north" style="height:110">
                    <div id="p" class="easyui-panel" title="选择学期课程"
                         style="width:199px;height:180px;padding:10px;background:#fafafa;"
                         data-options="closable:false,fit:true,
                         collapsible:false,minimizable:false,maximizable:false">
                        学期<br/>
                        <input id="ccSemester" class="easyui-combobox" name="semester"   
                               data-options="valueField:'id',textField:'text',
                               url:'../../servlet/util/Last5Semester',
                               onSelect: function(rec){
                               var url = '../../servlet/teacher/CurrentTeacherClass?semester='+rec.text;
                               $('#ccCourse').combobox('reload', url);
                               $.messager.show({
                               title:'提示',
                               msg:'您选择了学期：'+rec.text,
                               timeout:5000,
                               showType:'slide'
                               });
                               }"/>
                        <br/>
                        教学班级<br/>
                        <input id="ccCourse" class="easyui-combobox" name="course"   
                               data-options="valueField:'id',textField:'text',
                               onLoadSuccess:function(){
                               var options = $(this).combobox('getData');
                               $(this).combobox('select', options[0].id);
                               },
                               onSelect: function(rec){
                               onSelectCourse(rec);
                               }"
                               />
                    </div>
                </div>
                <div region ="center">
                    <div id="pmenu" class="easyui-panel" title="菜单"
                         style="padding:10px;background:#fafafa;"
                         data-options="closable:false,fit:true,
                         collapsible:false,minimizable:false,maximizable:false">
                        <a href="../teacher/course.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-computer">课程管理</a><br/>
                        <a href="../roster/roster.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-computer">名单管理</a><br/>
                        <a href="../lab/experiment.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-computer">实验管理</a><br/>
                        <a href="../lab/expScoreTable.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-computer">实验成绩</a><br/>
                        <a href="../homework/homework.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-homework16">作业管理</a><br/>
                        <a href="../homework/homeworkScoreTable.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-computer">作业成绩</a><br/>
                        <a href="../teacher/attendance.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-ok">考勤管理</a><br/>
                        <a href="../teacher/attendanceTable.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-computer">考勤总表</a><br/>
                        <a href="../teacher/score.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-computer">总评成绩</a><br/>
                        <a href="../main/setting.jsp" target='mainFrame' style="width:170px" class="easyui-linkbutton" plain="true" iconCls="icon-computer">设置&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a><br/>                            
                    </div>

                </div>
            </div>
        </div>
        <div id="mainPanle" region="center" style="overflow: hidden;">            
            <iframe id="mainFrame" name="mainFrame" scrolling="auto" frameborder="0" src="${url}" style="width:100%;height:100%;"></iframe>
         
        </div>
    </body>
</html>
